package huoye.shops.sp;

import android.content.Context;

import com.codeideology.android.utils.AXIPreference;

import huoye.shops.huoye.user.model.User;

/**
 * Created by who on 2018/8/14.
 */

public class SharedPreferencesHelper extends AXIPreference {


    private static final String KEY_USERNAME = "KEY_USERNAME";
    private static final String KEY_USER_PASSWORD = "KEY_USER_PASSWORD";
    private static final String KEY_USER_ID = "KEY_USER_ID";
    private static final String KEY_TOKEN = "KEY_SHOP_ID";
    private static final String KEY_PRPVOMCE = "KEY_PRPVOMCE";
    private static final String KEY_CITY = "KEY_CITY";
    private static final String KEY_AREA = "KEY_AREA";
    private static final String KEY_URL = "KEY_URL";
    private static final String KEY_IMAGE_URL = "KEY_IMAGE_URL";
    private static final String KEY_SHOP_LOGO = "KEY_SHOP_LOGO";
    private static final String KEY_CARD_TYPE = "KEY_CARD_TYPE";
    private static final String KEY_OVERDUE = "KEY_OVERDUE";
    private static final String KEY_IS_POWER_MANAGE = "KEY_IS_POWER_MANAGE";
    private static final String KEY_ANGENTID = "KEY_ANGENTID";
    private static final String KEY_WITHDRAW_ACCOUNT = "KEY_WITHDRAW_ACCOUNT";


    public SharedPreferencesHelper(Context context) {
        super(context);
    }

    public void saveUsername(String username) {
        this.saveString("KEY_USERNAME", username);
    }

    public String getUsername() {
        return this.getString("KEY_USERNAME", "");
    }

    public void removeUsername() {
        this.removeByKey("KEY_USERNAME");
    }


    public void saveAngentId(String angentId) {
        this.saveString("KEY_ANGENTID", angentId);
    }

    public String getAngentId() {
        return this.getString("KEY_ANGENTID", "");
    }

    public void removeAngentId() {
        this.removeByKey("KEY_ANGENTID");
    }

    public void savePassword(String password) {
        this.saveString("KEY_USER_PASSWORD", password);
    }

    public String getPassword() {
        return this.getString("KEY_USER_PASSWORD", "");
    }

    public void removePassword() {
        this.removeByKey("KEY_USER_PASSWORD");
    }

    public void saveUserId(String id) {
        this.saveString("KEY_USER_ID", id);
    }

    public String getUserId() {
        return this.getString("KEY_USER_ID", "");
    }

    public void removeUserId() {
        this.removeByKey("KEY_USER_ID");
    }

    public void saveUserShopId(String shopId) {
        this.saveString("KEY_SHOP_ID", shopId);
    }

    public String getUserShopId() {
        return this.getString("KEY_SHOP_ID", "");
    }

    public void removeUserShopId() {
        this.removeByKey("KEY_SHOP_ID");
    }

    public void saveCity(String city) {
        this.saveString("KEY_CITY", city);
    }

    public String getCity() {
        return this.getString("KEY_CITY", "");
    }

    public void removeCity() {
        this.removeByKey("KEY_CITY");
    }


    public void saveArea(String area) {
        this.saveString("KEY_AREA", area);
    }

    public String getArea() {
        return this.getString("KEY_AREA", "");
    }

    public void removeArea() {
        this.removeByKey("KEY_AREA");
    }


    public void saveProvince(String province) {
        this.saveString("KEY_PRPVOMCE", province);
    }

    public String getProvince() {
        return this.getString("KEY_PRPVOMCE", "");
    }

    public void removeProvince() {
        this.removeByKey("KEY_PRPVOMCE");
    }


    public void saveUrl(String url) {
        this.saveString("KEY_URL", url);
    }

    public String getUrl() {
        return this.getString("KEY_URL", "");
    }

    public void removeUrl() {
        this.removeByKey("KEY_URL");
    }


    public void saveImageUrl(String url) {
        this.saveString("KEY_IMAGE_URL", url);
    }

    public String getImageUrl() {
        return this.getString("KEY_IMAGE_URL", "");
    }

    public void removeImageUrl() {
        this.removeByKey("KEY_IMAGE_URL");
    }


    public void saveCardType(int iCardType) {
        this.saveInt("KEY_CARD_TYPE", iCardType);
    }

    public int getCardType() {
        return this.getInt("KEY_CARD_TYPE", 0);
    }

    public void removeCardType() {
        this.removeByKey("KEY_CARD_TYPE");
    }


    public void saveOverdue(boolean iOverdue) {
        this.saveBoolean("KEY_OVERDUE", iOverdue);
    }

    public boolean getOverdue() {
        return this.getBoolean("KEY_OVERDUE", true);
    }

    public void removeOverdue() {
        this.removeByKey("KEY_OVERDUE");
    }


    public void savePowerManage(boolean isPowerManage) {
        this.saveBoolean("KEY_IS_POWER_MANAGE",isPowerManage);
    }

    public boolean getPowerManage() {
        return this.getBoolean("KEY_IS_POWER_MANAGE", true);
    }

    public void removePowerManage() {
        this.removeByKey("KEY_IS_POWER_MANAGE");
    }


    public void saveShopLogo(String img) {
        this.saveString("KEY_SHOP_LOGO", img);
    }

    public String getShopLogo() {
        return this.getString("KEY_SHOP_LOGO", "");
    }

    public void removeShopLogo() {
        this.removeByKey("KEY_SHOP_LOGO");
    }


    public void saveWithdrawAccount(String account) {
        this.saveString("KEY_WITHDRAW_ACCOUNT", account);
    }

    public String getWithdrawAccount() {
        return this.getString("KEY_WITHDRAW_ACCOUNT", "");
    }

    public void removeWithdrawAccount() {
        this.removeByKey("KEY_WITHDRAW_ACCOUNT");
    }
}
